package com.ls.fw.search.lucene.bean;

import java.io.Serializable;

import org.apache.lucene.search.ScoreDoc;

/**
 * 用于记录分页关键信息
 * @author ls
 */
public class LastPageInfo implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	//最后文档
	private ScoreDoc lastDoc = null;
	
	//最后定位的索引目录名称
	private String dir = "";

	//最后定位的索引目录的页数
	private int page = 1;
	//当前索引目录的页数
	private int currentDirPage = 1;
	//当前索引目录使用的记录数
	private int currentDirUsedSize = 0;
	
	private long time = System.currentTimeMillis();

	
	public LastPageInfo(ScoreDoc lastDoc, String dir, int page,
			int currentDirPage, int currentDirUsedSize) {
		super();
		this.lastDoc = lastDoc;
		this.dir = dir;
		this.page = page;
		this.currentDirPage = currentDirPage;
		this.currentDirUsedSize = currentDirUsedSize;
	}

	public LastPageInfo() {
		super();
	}

	public ScoreDoc getLastDoc() {
		return lastDoc;
	}

	public void setLastDoc(ScoreDoc lastDoc) {
		this.lastDoc = lastDoc;
	}

	public String getDir() {
		return dir;
	}

	public void setDir(String dir) {
		this.dir = dir;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}
	
	
	@Override
	public String toString() {
		return "LastPageInfo [lastDoc=" + lastDoc.doc + ", dir=" + dir + ", page="
				+ page + "]";
	}


	public long getTime() {
		return time;
	}


	public void setTime(long time) {
		this.time = time;
	}
	
	public void refush(){
		time = System.currentTimeMillis();
	}


	public int getCurrentDirPage() {
		return currentDirPage;
	}


	public void setCurrentDirPage(int currentDirPage) {
		this.currentDirPage = currentDirPage;
	}


	public int getCurrentDirUsedSize() {
		return currentDirUsedSize;
	}


	public void setCurrentDirUsedSize(int currentDirUsedSize) {
		this.currentDirUsedSize = currentDirUsedSize;
	}
}
